From: Alexander Smorkalov Date: Thu, 18 Dec 2025 11:30:00 +0000 (+0100) Subject: FFmpeg 8.0 support 1/2 X-Git-Tag: archive/raspbian/4.10.0+dfsg-7+rpi1^2~2 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=c2811894632593735a7158f0f56ce3d9266efe15;p=opencv.git FFmpeg 8.0 support 1/2 Origin: upstream, https://github.com/opencv/opencv/commit/90c444abd387ffa70b2e72a34922903a2f0f4f5a Gbp-Pq: Name ffmpeg-8.0-compat-1.patch --- diff --git a/modules/videoio/src/cap_ffmpeg_impl.hpp b/modules/videoio/src/cap_ffmpeg_impl.hpp index 0546fbd..78037d5 100644 --- a/modules/videoio/src/cap_ffmpeg_impl.hpp +++ b/modules/videoio/src/cap_ffmpeg_impl.hpp @@ -680,7 +680,10 @@ void CvCapture_FFMPEG::close() if( video_st ) { #ifdef CV_FFMPEG_CODECPAR +// avcodec_close removed in FFmpeg release 8.0 +# if (LIBAVCODEC_BUILD < CALC_FFMPEG_VERSION(62, 11, 100)) avcodec_close( context ); +# endif #endif video_st = NULL; } @@ -1939,7 +1942,18 @@ void CvCapture_FFMPEG::get_rotation_angle() rotation_angle = 0; #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(57, 68, 100) const uint8_t *data = 0; + // av_stream_get_side_data removed in FFmpeg release 8.0 +# if (LIBAVCODEC_BUILD < CALC_FFMPEG_VERSION(62, 11, 100)) data = av_stream_get_side_data(video_st, AV_PKT_DATA_DISPLAYMATRIX, NULL); +# else + AVPacketSideData* sd = video_st->codecpar->coded_side_data; + int nb_sd = video_st->codecpar->nb_coded_side_data; + if (sd && nb_sd > 0) + { + const AVPacketSideData* mtx = av_packet_side_data_get(sd, nb_sd, AV_PKT_DATA_DISPLAYMATRIX); + data = mtx->data; + } +# endif if (data) { rotation_angle = -cvRound(av_display_rotation_get((const int32_t*)data));